package com.ruoyi.project.im.mapper;

import com.ruoyi.project.im.domain.ImTemporaryMessage;
import com.ruoyi.project.im.vo.MessageVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 临时消息Mapper接口
 *
 * @author hongwj
 * @date 2024-04-16
 */
public interface ImTemporaryMessageMapper {
    /**
     * 查询临时消息
     *
     * @param id 临时消息主键
     * @return 临时消息
     */
    public ImTemporaryMessage selectImTemporaryMessageById(Long id);

    /**
     * 查询临时消息列表
     *
     * @param imTemporaryMessage 临时消息
     * @return 临时消息集合
     */
    public List<ImTemporaryMessage> selectImTemporaryMessageList(ImTemporaryMessage imTemporaryMessage);

    /**
     * 新增临时消息
     *
     * @param imTemporaryMessage 临时消息
     * @return 结果
     */
    public int insertImTemporaryMessage(ImTemporaryMessage imTemporaryMessage);

    /**
     * 修改临时消息
     *
     * @param imTemporaryMessage 临时消息
     * @return 结果
     */
    public int updateImTemporaryMessage(ImTemporaryMessage imTemporaryMessage);

    /**
     * 删除临时消息
     *
     * @param id 临时消息主键
     * @return 结果
     */
    public int deleteImTemporaryMessageById(Long id);

    /**
     * 批量删除临时消息
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteImTemporaryMessageByIds(Long[] ids);

    @Delete("delete from im_temporary_message WHERE sender_id =#{chatUserId}  and receiver_id=#{currentUserId}  ")
    void deletePrivateTemporaryMessage(@Param("currentUserId") Long currentUserId, @Param("chatUserId") Long chatUserId);

    List<MessageVo> queryPrivateTemporaryMessage(@Param("currentUserId") Long currentUserId, @Param("chatUserId") Long chatUserId);


}
